This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal


Dec 5, 2016, 1:09 PM
13 Posts
topic has been resolvedResolved

Run in background client thread

  • Category: Domino Designer
  • Platform: Windows
  • Release: 9.0.1
  • Role: Developer
  • Tags: Agent client thread
  • Replies: 5

I have a script library that can create generic Excel report. This works great, but in some cases will take a great deal of time to run. I'd like an option to have this run in the background and permit the user to continue work in their notes client. Of course this can't run on the server because Excel doesn't live there.

I discovered the option: "Run in background client thread". If the user indicates that they want this to run in the background, then I activate an agent with:


  Set agent = db.GetAgent("BackgroundExport")
  Call agent.Run(cDoc.NoteID)

cDoc being a temporary control document that contains the name of the output file and the UNID of my controlling export selection document.

This *sort of* works. While the agent is running, I can switch between tabs in my notes client, but won't let me do anything substancial (like editing a document in another database) until the agent completes. Am I missing something? I've been very careful to let my scripts library export routine know that it's being asked to run in the background and therefor to avoid any UI interaction.

Dec 5, 2016, 1:51 PM
13 Posts
Sort of a security issue

One maxim I was taught early on in Notes Administration (back in 1995) is "Thou shalt not install non-Notes related software on your notes server".

Also, doing so would require the notes server have at least access to some other network drive onto which it would deposit the output file. (God forbid we should expose a drive on the notes server to public use.)

Anyway, in my case, I'm just a developer at this company. There's no way the administrators would permit that so it's not an option.

It's odd Barry that my post appears before yours (which is what I was replying to....) Our office isn't equipped with a time machine......

Dec 5, 2016, 1:56 PM
326 Posts
You Can

Install excel on the server

Dec 5, 2016, 2:41 PM
323 Posts
You're probably missing this ...

1. Any agent that is running in foreground already, is running in foreground.

2. Any agent invoked by agent.Run(), the calling agent waits for the agent to complete.

I'm focusing on the agent that's asking the question whether to run in background. It's probably running in foreground. And it's invoking agent.Run(). And it's waiting for the agent to complete.

 

If you're really interested in providing both options & running this agent in a background thread, launch it from a formula agent with @PostedCommand().

One more caveat, though.

COM operations can lock up your workstation while they work. While it's possible to minimize the hiccupping & shuddering, and while Excel is actually a master of minimizing this, it still happens, and you'll need to shut off a lot of foreground refreshes *in Excel* to make it happen.

Dec 6, 2016, 11:20 AM
13 Posts
Thanks!

Thanks Mike! That's what I was looking for. I even got by the problem of passing the UNID by using environment variables (which I think in this case is a better solution)

It's sort of wierd. While it's running, I have full mobility within Notes, but my print statements from the routine are showing up on the message bar rather than my logfile as I expected. (Not complaining though)

Wonder if they'll ever add a [NoWait] option to the lotusScript agent.run statement.

Dec 7, 2016, 12:49 AM
323 Posts
I've been waiting on that LS option for awhile, so probably not. (nt)

(Would be nice, wouldn't it.)


This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal